package pers.chao.tool.http;

/**
 * Description: 状态码
 *
 * @author W.Chao
 * @date 2021/1/11 23:58
 **/
public final class StatusCode {
	public static final StatusCode OK = new StatusCode(200, "ok");
	public static final StatusCode SUCCESS = new StatusCode(200, "success");
	public static final StatusCode INTERNAL_SERVER_ERROR = new StatusCode(500, "Internal Server Error");
	public static final StatusCode BAD_REQUEST = new StatusCode(400, "Bad Request");

	// 自定义业务状态码
	private int code;
	// 信息描述
	private String desc;

	private StatusCode(){}

	private StatusCode(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	public int getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

	public static StatusCode of(int code, String description){
		return new StatusCode(code, description);
	}
}
